﻿using Microsoft.AspNetCore.SignalR;

namespace WebApi.Hubs;

/// <summary>
/// Represents a SignalR hub for broadcasting clock-related updates to connected clients.
/// </summary>
/// <remarks>This hub allows clients to receive real-time updates about the current time. It uses the <see
/// cref="IClock"/> interface to define the client-side methods that can be invoked.</remarks>
public class ClockHub:Hub<IClock>
{
    /// <summary>
    /// Sends the specified time to all connected clients.
    /// </summary>
    /// <param name="time">The <see cref="DateTime"/> value to be sent to the clients.</param>
    /// <returns>A task that represents the asynchronous operation of sending the time to clients.</returns>
    public Task SendTimeToClients(DateTime time)
    {
        return Clients.All.ShowTime(time);
    }
}
